import { getCategoryList } from '@/api/category'
// 导航分类模块
export default {
  namespaced: true,
  state: () => ({
    categorylist: [] // 分类列表
  }),
  mutations: {
    Setcategorylist (state, list) {
      state.categorylist = list
    }

  },
  actions: {
    async asyncSetcategorylist (ctx) {
      //   调用接口
      const res = await getCategoryList()
      console.log(res)
      //  通过调用mutation函数  修改state里的categorylist
      ctx.commit('Setcategorylist', res.data.result)
    }
  }
}
